﻿using UnityEngine;
using System.Collections;

public class Blendertree_charactercontrol : MonoBehaviour {
	Animator anim;
	float vertical,horizontal;
	float runspeed=1;
	// Use this for initialization
	void Start () {
		anim=GetComponent<Animator>();
	}
	
	// Update is called once per frame
	void Update () {
		vertical = Input.GetAxis ("Vertical");
		horizontal = Input.GetAxis ("Horizontal");
		//按下SHIFT后过度加速/减速
		if (Input.GetKey (KeyCode.LeftShift)) {

			runspeed=Mathf.MoveTowards(runspeed,2,Time.deltaTime);
		} else {
			runspeed=Mathf.MoveTowards(runspeed,1,Time.deltaTime);
		
		}
		anim.SetFloat("Speed",vertical*runspeed);
		//过度到当前水平，每次0.25
		anim.SetFloat("Direction",horizontal,0.25f,Time.deltaTime);

	}
}
